﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Graphics;

using TomShane.Neoforce.Controls;

namespace tactics.GUI.Menu
{
    public class InGameMenu : GameStateManagement.GameScreen
    {
        Manager guiManager;
        Panel background;
        Label resume;
        Label exit;

        public InGameMenu(Manager guiManagerIn)
        {
            guiManager = guiManagerIn;
            background = new Panel(guiManager);
            background.Init();

            background.Width = guiManager.GraphicsDevice.DisplayMode.Width;
            background.Height = guiManager.GraphicsDevice.DisplayMode.Height;

            resume = new Label(guiManager);
            resume.Init();
            resume.Text = "Resume";

            resume.Top = (background.Height / 2) - (resume.Height / 2);
            resume.Left = (background.Width / 4);
            resume.Passive = false;
            resume.Click += new TomShane.Neoforce.Controls.EventHandler(resume_Click);

            exit = new Label(guiManager);
            exit.Init();
            exit.Text = "Quit Game";
            exit.Passive = false;
            exit.Top = (background.Height / 2) -  (exit.Height / 2) + 200;
            exit.Left = (background.Width / 4);

            exit.Click += new TomShane.Neoforce.Controls.EventHandler(exit_Click);

            background.Add(resume);
            background.Add(exit);
            background.Alpha = 128;
        }

        public override void LoadContent()
        {
            base.LoadContent();

            guiManager.Add(background);
        }

        void exit_Click(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            TacticsEngine.Instance.QuitGame();
            guiManager.Remove(background);
            ExitScreen();
        }

        void resume_Click(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            guiManager.Remove(background);
            ExitScreen();
        }

        ~InGameMenu()
        {
            guiManager.Remove(background);
        }
    }
}
